package com.yidu.model;

public class Page {

	private int rows = 10 ; //每页显示的条数
	private int pages ; //当前页数
	private int total  ; //总条数
	private int totalPages ; //总页数
	private int startRows ; //开始行数
	private int endRows ; //结束行数
	private String name;
	private String userId;
	
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public int getPages() {
		return pages;
	}
	public void setPages(int pages) {
		this.pages = pages;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	
	/**
	 * 总页数的算法
	 * @return
	 */
	public int getTotalPages() {
		if(total%rows==0){
			totalPages = total/rows ;
		}else{
			totalPages = (total/rows) + 1;
		}
		return totalPages;
	}
	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}
	
	/**
	 * 开始行数的算法
	 * @return
	 */
	public int getStartRows() {
		startRows  = rows*(pages-1)+1;
		return startRows;
	}
	public void setStartRows(int startRows) {
		
		this.startRows = startRows;
	}
	
	/**
	 * 结束行数的算法
	 * @return
	 */
	public int getEndRows() {
		endRows = startRows + rows -1 ;
		return endRows;
	}
	public void setEndRows(int endRows) {
		this.endRows = endRows;
	}
}
